<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link href="{{.Site.Root}}/bundle/index.css" rel="stylesheet">
    <link href="{{.Site.Root}}/bundle/markdown.css" rel="stylesheet">
    <link rel="shortcut icon" href="{{.Site.Logo}}">
</head>
{{if .Develop}}
    <script type="text/javascript">
    var conn, reloadTimer, connectTimer;
    var connect = function() {
        conn = new WebSocket('ws://' + location.host + '/websocket');
        conn.onmessage = function(event) {
            if (event.data === 'change') {
                if (reloadTimer) clearTimeout(reloadTimer);
                reloadTimer = setTimeout(function() {
                    window.location.reload();
                }, 200);
            }
        };
        conn.onclose = function() {
            if (connectTimer) clearTimeout(connectTimer);
            connectTimer = setTimeout(function() {
                connect();
            }, 1000);
        };
    };
    connect();
</script>
{{end}}